"use client";

import { Provider } from "react-redux";
import { store } from "@/hooks/store";
import { PersistGate } from "redux-persist/integration/react";
import { persistStore } from "redux-persist";
const persistor = persistStore(store);

//redux 注入App包裹子组件
//使用react-persist对store进行持久化，刷新回退都不会丢失Redux
export function Providers({ children }: { children: React.ReactNode }) {
  return (
    <Provider store={store}>
      <PersistGate persistor={persistor}>{children}</PersistGate>
    </Provider>
  );
}
